hysop.fields.variable_parameter module¶
Tools to define parameters that do not depend on space but may depend on simulation parameters.
Example : the flow rate through the inlet
def frate(simu):
res = np.zeros(problem.dimension)
res[...] = np.sin(simu.time)
return res
# define the parameter ...
rate = VariableParameter(formula=frate)
...
# compute its value for the current simulation state
rate.update(simu)
Notes
frate must be a python function with a simulation object as input.
update function is usually called during operator apply (for instance adaptive time step or absorption_BC).
- class hysop.fields.variable_parameter.VariableParameter(data=0.0, formula=None)[source]¶
Bases:
object
User-defined parameter (a dictionnary indeed) that may depend on simulation parameters values and so needs some update during simulation process.
- Parameters:
data (real or integer, optional) – default or initial value of the parameter
formula (python function, optional) – how to compute the variable